void ppreciseSleep(int ms) {
    timeBeginPeriod(1);

    LARGE_INTEGER frequency;
    LARGE_INTEGER start, end;
    double interval;

    // 获取计时器频率
    QueryPerformanceFrequency(&frequency);
    interval = (double)frequency.QuadPart / 1000.0;

    // 获取开始时间
    QueryPerformanceCounter(&start);

    // 粗略休眠
    Sleep(ms - 1);  // 休眠9毫秒

    // 计算目标时间
    int64_t target = start.QuadPart + (int64_t)(ms * interval);

    // 精细调整
    while (true) {
        QueryPerformanceCounter(&end);
        if (end.QuadPart >= target) {
            timeEndPeriod(1);
            break;
        }
    }
}